import os,sys,time,re
def get_file_ip(filename):
    ip=""
    f=open(filename,"r")
    data=f.readlines()
    for i in data:
        result = re.findall(r'\D(?:\d{1,3}\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\D',i)
        if result[0].split(".")[0].strip()=="222":
            ip=result[0]
            return (ip)
file_path="D:\共享IP\运营"
file_hz=".txt"
for i in  os.walk(file_path):
    for z in (i[2]):
        if file_hz in z:
            name=(z.split(".")[0])
            ip= (get_file_ip(file_path+"\\"+z).replace("\n", "").strip())
            print (name+"/"+ip+"/administrator/29053303")